<template>
	<button class="btn btn-sm btn-primary" @click="updateAd">修改</button>
  <vue-modal
    title="修改首页广告"
    ok-text="提交"
    cancel-text="取消"
    :show.sync="showUpdateAdModal"
    effect="fade"
    :small="true"
    :width="500"
    :callback="submit">
    <div slot="modal-body" class="modal-body">
      <form class="form-horizontal" role="form">
        <div class="form-group form-group-sm">
          <label class="col-sm-3 control-label">*任务名</label>
          <div class="col-sm-9 text-left">
            <input type="text" class="form-control" v-model="ad.title">
          </div>
        </div>
        <div class="form-group form-group-sm">
          <label class="col-sm-3 control-label">*开始时间</label>
          <div class="col-sm-9 text-left">
            <vue-date-picker
              :time.sync="ad.startTime"
              :option='datePickerOption'>
            </vue-date-picker>
          </div>
        </div>
        <div class="form-group form-group-sm">
          <label class="col-sm-3 control-label">*结束时间</label>
          <div class="col-sm-9 text-left">
            <vue-date-picker
              :time.sync="ad.endTime"
              :option='datePickerOption'>
            </vue-date-picker>
          </div>
        </div>
        <div class="form-group form-group-sm">
          <label class="col-sm-3 control-label">广告图*</label>
          <div class="col-sm-9 text-left">
          	<div class="pic-url" v-if="ad.picUrl">
          		原广告图：<br>
          		<img :src="ad.picUrl">
          	</div>
            <input type="file" class="form-control" accept="image/jpeg,image/png" v-model="ad.file" v-el:file>
          </div>
        </div>
        <div class="form-group form-group-sm">
          <label class="col-sm-3 control-label">*跳转内容类型</label>
          <div class="col-sm-9">
            <select class="form-control" v-model="ad.type">
              <option value="-1">请选择</option>
              <option value="1">CMS文章</option>
              <option value="2">第三方网址</option>
              <option value="3">金贝塔</option>
              <option value="4">用户</option>
              <option value="7">话题</option>
              <option value="8">动态</option>
              <option value="9">股市直播</option>
              <option value="10">迷你组合</option>
              <option value="11">存股宝</option>
              <option value="12">文章栏目</option>
              <option value="13">港股入金</option>
              <option value="14">交易Tab</option>
            </select>
          </div>
        </div>
        <div class="form-group form-group-sm" v-if=" +ad.type !== -1 && +ad.type !== 9">
          <label class="col-sm-3 control-label">*{{ad.type | adTypeTargetCase}}</label>
          <div class="col-sm-9 text-left">
            <input type="text" class="form-control" v-model="ad.location">
          </div>
        </div>
        <div class="form-group form-group-sm">
          <label class="col-sm-3 control-label">*跳转文案</label>
          <div class="col-sm-9 text-left">
            <input type="text" class="form-control" v-model="ad.buttonDesc">
          </div>
        </div>
        <div class="form-group form-group-sm">
          <label class="col-sm-3 control-label">*外部浏览器打开</label>
          <div class="col-sm-9 text-left">
            <select class="form-control" v-model="ad.forceExternalBrowser">
              <option value="0">否</option>
              <option value="1">是</option>
            </select>
          </div>
        </div>
         <!-- 新增可见人群 -->
        <div class="form-group form-group-sm">
          <label class="col-sm-3 control-label">*可见人群</label>
          <div class="col-sm-9 text-left">
            <select class="form-control" v-model="ad.showToNewUser">
              <option value="0">所有人</option>
              <option value="1">新用户</option>
            </select>
          </div>
        </div>
        <div class="form-group form-group-sm">
          <label class="col-sm-3 control-label">渠道地址</label>
          <div class="col-sm-9 text-left">
            <input type="text" class="form-control" v-model="ad.channel">
          </div>
        </div>
      </form>
    </div>
  </vue-modal>
</template>
<style src="./index-ad-update.css" scoped></style>
<script src="./index-ad-update.js"></script>
